<include file="public/header"/>
<link rel="stylesheet" href="__STATIC__/css/weui/weui.min.css">
<body>
<header>
    <div class="tab_nav">
        <div class="header">
            <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
            <div class="h-mid">信息修改</div>
            <div class="h-right">
                <aside class="top_bar">
                    <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a
                            href="javascript:;"></a></div>
                </aside>
            </div>
        </div>
    </div>
</header>
<include file="public/menu"/>
<div id="tbh5v0">
    <div class="Personal">
        <div id="tbh5v0">
            <div class="innercontent1">
                <form method="post" action="" id="edit_profile" onSubmit="return checkinfo()">
                    <div class="name"><span>昵　 称</span>
                        <input type="text" name="nickname" id="nickname" value="{$user.nickname|shownickname=###}" placeholder="*昵称"
                               class="c-f-text">
                    </div>

                    <div class="name1"><span><span style="color:red;display:inline-block;width:10px">*</span>性　 别</span>
                        <ul>
                            
                            <li
                            <?php if($user['sex']==1) {echo 'class="on"';} ?> >
                            <label for="sex1">
                                <input type="radio" name="sex" value="1" tabindex="3" class="radio"
                                       id="sex1" <?php if($user['sex']==1) {echo 'checked="checked"';} ?> >
                                男</label>
                            </li>
                            <li
                            <?php if($user['sex']==2) {echo 'class="on"';} ?> >
                            <label for="sex2">
                                <input type="radio" name="sex" value="2" tabindex="4" class="radio"
                                       id="sex2" <?php if($user['sex']==2) {echo 'checked="checked"';} ?>>
                                女</label>
                            </li>
                        </ul>
                    </div>
                    <div class="name">
                        <label for="birthday"> <span><span style="color:red;display:inline-block;width:10px">*</span>生　 日</span>
                            <input name="birthday" style="margin-left:15px" <notempty name="$user['birthday']">value="{$user.birthday|date='Y-m-d',###}" readonly="readonly" <else/>id="birthday"</notempty> placeholder="*出生年日" type="text"/>
                        </label>
                    </div>
                    
                    <div class="name">
                        <label for="mobile_ep"> <span><span style="color:red;display:inline-block;width:10px">*</span>手　 机</span>
                        <input name="mobile" value="{$user.mobile}" id="mobile_ep" placeholder="*手机号码" type="text" style="margin-left:15px" <notempty name="$user['mobile']"> readonly="readonly"</notempty> />
                        </label>
                    </div>
                    <div class="name">
                        <label for="mobile_code"> <span><span style="color:red;display:inline-block;width:10px">*</span>验证码</span>
                            <input type="text" id="mobile_code"  name="mobile_code" placeholder="手机验证码" style="margin-left:15px"/>
                        </label>
                        <input id="zphone" type="button" rel="mobile" disabled="true" value="" onClick="sendcode()"  class="zphone">
                    </div>

                    <div class="name1"><span><span style="color:red;display:inline-block;width:10px">*</span>婚　 否</span>
                        <ul>
                            <li
                            <?php if($user['is_marry']==1) {echo 'class="on"';} ?> >
                            <label for="is_marry0">
                                <input type="radio" name="is_marry" value="0" tabindex="1" class="radio"
                                       id="is_marry0" <?php if($user['is_marry']==1) {echo 'checked="checked"';} ?> >
                                未婚</label>
                            </li>
                            <li
                            <?php if($user['is_marry']==0) {echo 'class="on"';} ?>   >
                            <label for="is_marry1">
                                <input type="radio" name="is_marry" value="1" tabindex="2" class="radio"
                                       id="is_marry1" <?php if($user['is_marry']==0) {echo 'checked="checked"';} ?>>
                                已婚</label>
                            </li>
                            
                        </ul>
                    </div>
                    <div class="name actionsheet">
                        <label for="work"><span><span style="color:red;display:inline-block;width:10px">*</span>职　 业</span>
                        <input name="work" value="{$user.work}" id="work" placeholder="请选择您的职业" type="text" readonly="readonly" style="margin-left:15px"/>
                        </label>
                    </div>
                    <div class="name actionsheet">
                        <label for="income"><span><span style="color:red;display:inline-block;width:10px">*</span>收　 入</span>
                        <input name="income" value="{$user.income}" id="income" placeholder="请填写您的收入" type="text"  readonly="readonly" style="margin-left:15px"/>
                        </label>
                    </div>
                    <div class="name actionsheet" style="display:flex">
                        <div style="flex:1">
                        <label for="dressing_style"> <span><span style="color:red;display:inline-block;width:10px">*</span>穿衣风格</span>
                        <input name="dressing_style" value="{$user.dressing_style}" id="dressing_style" placeholder="选择风格" type="text"  readonly="readonly" style="text-align:center"/>
                        </label></div>
                        <div style="flex:1">
                        <label for="upper_size"> <span><span style="color:red;display:inline-block;width:10px">*</span>上衣尺码</span>
                        <input name="upper_size" value="{$user.upper_size}" id="upper_size" placeholder="选择尺码" type="text"  readonly="readonly" style="text-align:center"/>
                        </label></div>
                    </div>
                    <div class="name actionsheet" style="display:flex">
                        <div style="flex:1">
                        <label for="trousers_size"> <span><span style="color:red;display:inline-block;width:10px">*</span>裤子尺码</span>
                        <input name="trousers_size" value="{$user.trousers_size}" id="trousers_size" placeholder="选择尺码" type="text"  readonly="readonly" style="text-align:center"/>
                        </label></div>
                        <div style="flex:1">
                        <label for="shose_size"> <span><span style="color:red;display:inline-block;width:10px">*</span>鞋品尺码</span>
                        <input name="shose_size" value="{$user.shose_size}" id="shose_size" placeholder="选择尺码" type="text"  readonly="readonly" style="text-align:center"/>
                        </label></div>
                    </div>
                  
                    <div class="field submit-btn">
                        <empty name="user['mobile']">
                           <input type="submit" value="注册会员" class="btn_big1"/>
                        <else/>
                           <input type="submit" value="确认修改" class="btn_big1"/>
                        </empty>
                    </div>
                    <input type="hidden" name="scene" value="6">
                </form>
            </div>

          <!--   <div class="innercontent1">
                <form method="post" action="" id="edit_mobile" onSubmit="return checkMobileForm()">
                	<input type="hidden" name="scene" value="6">
                    <div class="name">
                        <label for="mobile_ep"> <span>手机</span>
                            <input name="mobile" value="{$user.mobile}" id="mobile_ep" placeholder="*手机号码" type="text"/>
                        </label>
                    </div>
                    <div class="name">
                        <label for="mobile_code"> <span>验证码</span>
                            <input type="text" id="mobile_code"  name="mobile_code" placeholder="手机验证码" />
                            <input id="zphone" type="button" rel="mobile" value="获取手机验证码 " onClick="sendcode(this)"  class="zphone">
                        </label>
                    </div>
                    <div class="field submit-btn">
                        <input type="submit" value="确认修改" class="btn_big1"/>
                    </div>
                </form>
            </div> -->

            <!-- <div class="innercontent11">
                <form name="formPassword" action="{:U('User/password')}" method="post" onSubmit="return editPassword()">
                    <h4 class="title">密码修改</h4>

                    <div class="field_pwd">
                        <label for="password">
                            <input type="password" name="old_password" id="password" class="c-f-text" placeholder="原密码"
                                   value=""/>
                        </label>
                    </div>
                    <div class="field_pwd">
                        <label for="new_password">
                            <input type="password" name="new_password" id="new_password" class="c-f-text"
                                   placeholder="新密码"/>
                        </label>
                    </div>
                    <div class="field_pwd">
                        <label for="comfirm_password">
                            <input type="password" name="confirm_password" id="comfirm_password" class="c-f-text"
                                   placeholder="确认密码"/>
                        </label>
                    </div>
                    <div class="field submit-btn">
                        <input type="submit" value="确认修改" class="btn_big1"/>
                    </div>
                </form>
            </div> -->
        </div>
    </div>
    <!--BEGIN actionSheet-->
       <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="work">
               <div class="weui-actionsheet__menu">
                <volist name="work" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
    <!--    <div class="weui-skin_android" id="androidActionsheet" style="display: none">
               <div class="weui-mask"></div>
               <div class="weui-actionsheet" target="work">
                   <div class="weui-actionsheet__menu">
                       <volist name="work" id="vo">
                          <div class="weui-actionsheet__cell">{$vo}</div>
                       </volist>
                   </div>
               </div>
           </div> -->
         <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="income">
               <div class="weui-actionsheet__menu">
                   <volist name="income" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
         <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="dressing_style">
               <div class="weui-actionsheet__menu">
                   <volist name="dress_style" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
         <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="upper_size">
               <div class="weui-actionsheet__menu">
                   <volist name="upper_size" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
          <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="trousers_size">
               <div class="weui-actionsheet__menu">
                   <volist name="trousers_size" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
          <div>
           <div class="weui-mask" id="iosMask" style="display: none"></div>
           <div class="weui-actionsheet" target="shose_size">
               <div class="weui-actionsheet__menu">
                   <volist name="shose_size" id="vo">
                   <div class="weui-actionsheet__cell">{$vo}</div>
                </volist>
               </div>
               <div class="weui-actionsheet__action">
                   <div class="weui-actionsheet__cell" id="iosActionsheetCancel">取消</div>
               </div>
           </div>
       </div>
    <script src="__PUBLIC__/js/mobiscroll.core-2.5.2.js" type="text/javascript"></script>
    
    <script src="__PUBLIC__/js/mobiscroll.core-2.5.2-zh.js" type="text/javascript"></script>
    
    <link href="__PUBLIC__/css/mobiscroll.core-2.5.2.css" rel="stylesheet" type="text/css" />
    
    <script src="__PUBLIC__/js/mobiscroll.datetime-2.5.1.js" type="text/javascript"></script>
    
    <script src="__PUBLIC__/js/mobiscroll.datetime-2.5.1-zh.js" type="text/javascript"></script>
      <!-- S 可根据自己喜好引入样式风格文件 -->

  <script src="__PUBLIC__/js/mobiscroll.android-ics-2.5.2.js" type="text/javascript"></script>
 
 <link href="__PUBLIC__/css/mobiscroll.android-ics-2.5.2.css" rel="stylesheet" type="text/css" />
 <script src="__STATIC__/js/weui.min.js" type="text/javascript"></script>
<!-- <script src="__PUBLIC__/js/vconsole.min.js" type="text/javascript"></script> -->
  <!-- E 可根据自己喜好引入样式风格文件 -->
    <script>
        $('.name1 ul li').click(function () {
            $(this).find("input").attr("checked", "checked");
            $(this).parent().children('li').removeClass("on");
            $(this).addClass("on");
        })
        
    </script>
</div>

<script language="javascript">
    $(function () {
        $('input[type=text],input[type=password]').bind({
            focus: function () {
                $(".global-nav").css("display", 'none');
            },
            blur: function () {
                $(".global-nav").css("display", 'flex');
            }
           
        });
        $('input[type=text],input[type=radio]').bind({
            change:function(){
                $('#zphone').attr("disabled", false);
                $('#zphone').val("获取手机验证码");
            }
        })
        $('input[type=radio]').bind({
            click:function(){
                var sexno=$(this).val();
                if(sexno!='{$user["sex"]}'){
                    $('#zphone').attr("disabled", false);
                    $('#zphone').val("获取手机验证码");
                }
            }
        })
    })

    var email_empty = "请输入您的电子邮件地址！";
    var email_error = "您输入的电子邮件地址格式不正确！";
    var old_password_empty = "请输入您的原密码！";
    var new_password_empty = "请输入6位以上新密码！";
    var confirm_password_empty = "请输入6位以上确认密码！";
    var both_password_error = "您现两次输入的密码不一致！";
    /* 会员修改密码 */
    function editPassword() {
        var frm = document.forms['formPassword'];
        var old_password = frm.elements['old_password'].value;
        var new_password = frm.elements['new_password'].value;
        var confirm_password = frm.elements['comfirm_password'].value;

        var msg = '';
        var reg = null;

        if (old_password.length == 0) {
            msg += old_password_empty + '\n';
        }

        if (new_password.length < 6) {
            msg += new_password_empty + '\n';
        }

        if (confirm_password.length < 6) {
            msg += confirm_password_empty + '\n';
        }

        if (new_password.length > 0 && confirm_password.length > 0) {
            if (new_password != confirm_password) {
                msg += both_password_error + '\n';
            }
        }

        if (msg.length > 0) {
            layer.open({content: msg, time: 2});
            return false;
        } else {
            return true;
        }
    }
   var mobile_flag = false;
    function checkinfo() {
        var nickname = $('#nickname').val();
        var birthday = $('#birthday').val();
        var mobile = $('#mobile_ep').val();
        var work = $('#work').val();
        var mobile_code = $('#mobile_code').val();
        var income = $('#income').val();
        var upper_size = $('#upper_size').val();
        var dressing_style=$('#dressing_style').val();
        var upper_size=$('#upper_size').val();
        var trousers_size=$('#trousers_size').val();
        var shose_size=$('#shose_size').val();
        if (nickname == '') {
            layer.open({content: "昵称不能为空", time: 2});
            return false;
        }

        if (birthday == '') {
            layer.open({content: "请填写生日", time: 2});
            return false;
        }
         if (work == '') {
            layer.open({content: "请填写职业", time: 2});
            return false;
        }
        if (dressing_style == '') {
            layer.open({content: "请选择穿衣风格", time: 2});
            return false;
        }
        if (upper_size == '') {
            layer.open({content: "请选择上衣尺码", time: 2});
            return false;
        }
        if (trousers_size == '') {
            layer.open({content: "请选择裤子尺码", time: 2});
            return false;
        }
        if (shose_size == '') {
            layer.open({content: "请填写鞋品尺码", time: 2});
            return false;
        }
        if (!checkMobile(mobile)) {
            layer.open({content: "手机格式不正确", time: 2});
            return false;
        }
        if (mobile_code == '') {
            layer.open({content: "请填写手机验证码", time: 2});
            return false;
        }
        if (income == '') {
            layer.open({content: "请填写您的收入", time: 2});
            return false;
        }
        if (!mobile_flag) {
            layer.open({content: "请先获取手机验证码", time: 2});
            return false;
        }
        return true;
    }

    $('[readonly="readonly"]').click(function(){
        $(this).blur();
    })

    /*function checkMobileForm() {
        var mobile = $('#mobile_ep').val();
        var mobile_code = $('#mobile_code').val();
        if (!checkMobile(mobile)) {
            alert("手机格式不正确");
            return false;
        }
        if (mobile_code == '') {
            alert("请填写手机验证码");
            return false;
        }
        if (!mobile_flag) {
            alert("请先获取手机验证码");
            return false;
        }
        return true;
    }
*/

 
    //发送验证码
    function sendcode() {
        var mobile = $('#mobile_ep').val();
        if (!checkMobile(mobile)) {
            alert("手机格式不正确");
        } else {
            $.ajax({
                url: '/index.php?m=Home&c=Api&a=send_validate_code&scene=1&t=' + Math.random(),
                type: 'post',
                dataType: 'json',
                data: {type: $("#zphone").attr('rel'), send: $.trim($('#mobile_ep').val()), scene:1},
                success: function (res) {
                    if (res.status == 1) {
                        mobile_flag = true;
                        layer.open({content: res.msg, time: 1});
                        countdown();
                    } else {
                        mobile_flag = false;
                        layer.open({content: res.msg, time: 2});
                    }
                }
            });
        }
    }

    var wait = 60;
    var msg=null;
    function countdown() {
       var obj = $("#zphone");
        if (wait == 0) {
            obj.removeAttr("disabled");
            obj.val(msg);
            wait = 60;
        } else {
            if (msg==null) {
                msg = obj.val();
            }
            obj.attr("disabled", "disabled");
            obj.val(wait + "秒后重新获取");
            wait--;
            setTimeout(function () {
                countdown()
            }, 1000)
        }
    }

   //datetime插件

       $(function () {

         var currYear = (new Date()).getFullYear();  

         var opt={};

         opt.date = {preset : 'date'};

         //opt.datetime = { preset : 'datetime', minDate: new Date(2012,3,10,9,22), maxDate: new Date(2014,7,30,15,44), stepMinute: 5  };

         opt.datetime = {preset : 'datetime'};

         opt.time = {preset : 'time'};

         opt.default = {

                 theme: 'android-ics light', //皮肤样式

                display: 'modal', //显示方式 

                mode: 'scroller', //日期选择模式

                 lang:'zh',

                startYear:currYear - 100, //开始年份

                endYear:currYear + 10 //结束年份

         };

         $("#birthday").scroller('destroy').scroller($.extend(opt['date'], opt['default']));

    });

       $(function(){
               $('#iosMask').click(function(){
                    $('.weui-actionsheet__action .weui-actionsheet__cell').trigger("click");
               });
 
               $('.weui-actionsheet__action .weui-actionsheet__cell').on('click', function(){
                   var cls=$(this).parents('.weui-actionsheet').attr('target');
                   $('[target="'+cls+'"]').removeClass('weui-actionsheet_toggle');
                   $('#iosMask').fadeOut(200);
               });
               $(".actionsheet").on("click", "input",function(){
                   var name=$(this).attr('name');
                   $('[target="'+name+'"]').addClass('weui-actionsheet_toggle');
                   $('#iosMask').fadeIn(200);
               });
               $('.weui-actionsheet__menu .weui-actionsheet__cell').click(function(){
                 var cls=$(this).parents('.weui-actionsheet').attr('target');
                 var text=$(this).text();
                 $('[name="'+cls+'"]').val(text);
                 $('#zphone').attr("disabled", false);
                 $('#zphone').val("获取手机验证码");
                 $('.weui-actionsheet__action .weui-actionsheet__cell').trigger("click");
               })
           });
  /*  // android
    $(function(){
        var $androidActionSheet = $('#androidActionsheet');
        var $androidMask = $androidActionSheet.find('.weui-mask');

        $("#work").on('click', function(){
            $androidActionSheet.fadeIn(200);
            $androidMask.on('click',function () {
                $androidActionSheet.fadeOut(200);
            });
        });
    });*/
</script>
</body>
</html>